package com.heima.article.controller;

import com.heima.article.entity.ApAuthor;
import com.heima.article.service.ApAuthorService;
import com.heima.model.article.dtos.AuthorDto;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/author")
public class AuthorController {

    @Autowired
    private ApAuthorService apAuthorService;

    //根据appUserId查询作者信息
    @GetMapping("/findByUserId/{id}")
    public ApAuthor findById(@PathVariable Integer id){
        return apAuthorService.getById(id);
    }

    //保存作者信息
    @PostMapping("/save")
    public Integer save(@RequestBody AuthorDto dto){
        return apAuthorService.saveAuthor(dto);
    }


}
